#!/bin/sh
MASK_INSTALL_PATH=/usr/local/mask
current_path=`pwd`

cd lib/mysql-5.1.52;
./configure --with-embedded-server;
make clean && make -j 32;
echo "build mysql lib ok."

mkdir -p ${MASK_INSTALL_PATH}/data/share/mysql
cd sql/share;
rm -rf ${MASK_INSTALL_PATH}/data/share/mysql/*
cp -r * ${MASK_INSTALL_PATH}/data/share/mysql/
find ${MASK_INSTALL_PATH}/data/share/mysql/ -type f -a -name "*svn*" -exec rm -rf {} \;
find ${MASK_INSTALL_PATH}/data/share/mysql/ -type f -a -name "Makefile*" -exec rm -rf {} \;
echo "install mysql data ok."

cd ${current_path} ;
./configure --bindir=${MASK_INSTALL_PATH}/bin --sysconfdir=${MASK_INSTALL_PATH}/conf;
make clean && make -j 16 && make install;
echo "build && install maskd ok."


